#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<sys/types.h>
#include<fcntl.h>
#include<cassert>
#include<unistd.h>
#include<cstring>

#define PATHNAME "/home/ldh/tmp/mypipe"


int main()
{
    int fd=open(PATHNAME,O_WRONLY);
    assert(fd!=-1);
    int cnt=0;
    const char *msg="hello I am client !";
    char buffer[1024];
    while(cnt<10)
    {
        cnt++;
        sprintf(buffer,"%s NOW:%d",msg,cnt);
        write(fd,buffer,strlen(buffer));
        sleep(1);
    }
    
    close(fd);
    return 0;
}
